// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

#ifndef CEF_TESTS_CEFCLIENT_BROWSER_USER_MANAGER_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_USER_MANAGER_H_
#pragma once

#include <string>

#include "include/base/cef_ref_counted.h"
#include "include/internal/cef_types_wrappers.h" 
#include "tests/cefclient/browser/urlrequest_client.h"

namespace client {
	 


	class UserIconRequestHandler : public UrlRequestCompletionCallback {
	public:
		UserIconRequestHandler( );
		void OnCompletion(CefURLRequest::ErrorCode errorCode, const  std::string & data);
		void OnRequestFailed();
	};


// Used to store user info and login token. The methods of this
// class are thread-safe unless otherwise indicated.
class UserManager  {
 public:
 
  // Returns the singleton instance of this object.
  static UserManager* Get();

  // Returns token from file.
  CefString GetCachePath();
  CefString GetPlayCachePath();
  std::wstring GetUserDataPath();
  std::wstring GetJsPath();
  void Logout();
  // this is used in login modle
  virtual int SaveLoginToken(CefString &token);
  virtual std::string GetLoginToken( );
  //void SaveRootHandler(HWND handler)  ;
  //  invalid 
  void  DownLoadUserIcon(const std::string &url);
  // invalid
std::string  ReadUserInfo();
void ReadUserToken();
  int   Construct();
  bool IsLogin();  

protected:
  UserManager();
  ~UserManager();

private:
	void GetDocumentsPath();
	 
	//HWND GetRootHandler();
 
 
private:
	std::wstring document_path_;
	std::string token_;
	HWND  root_handler_;
	bool islogin_;

};

}  // namespace client

#endif  // CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_
